home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / SELFTREE.ZIP / selftree / include / leafshapes.inc next >
Encoding:
Text File  |  1997-09-03  |  6.7 KB  |  269 lines

  1. /* Some sample-shapes, that makes usable leafs for trees. */
  2.  
  3. /*
  4.  
  5.           LEAFSHAPE_00  :  simple polygon with some jags
  6.           LEAFSHAPE_01  :  a mesh, similar to LEAFSHAPE_00, but not as flat as LEAFSHAPE_00
  7.           LEAFSHAPE_02  :  a simple flat pressed sphere
  8.           LEAFSHAPE_03  :  a leaf mad of blob, slow to render
  9.  
  10.           LEAF_TEXTURE_SUMMER : a summer-texture
  11.           LEAF_TEXTURE_AUTUMN : a autumn-texture
  12.  
  13.           LEAF_SUMMER_00 : a summer-leaf with LEAFSHAPE_00
  14.           LEAF_SUMMER_01 : a summer-leaf with LEAFSHAPE_01
  15.           LEAF_SUMMER_02 : a summer-leaf with LEAFSHAPE_02
  16.           LEAF_SUMMER_03 : a summer-leaf with LEAFSHAPE_03
  17.  
  18.           LEAF_AUTUMN_00 : a autumn-leaf with LEAFSHAPE_00
  19.           LEAF_AUTUMN_01 : a autumn-leaf with LEAFSHAPE_01
  20.           LEAF_AUTUMN_02 : a autumn-leaf with LEAFSHAPE_02
  21.           LEAF_AUTUMN_03 : a autumn-leaf with LEAFSHAPE_03
  22. */
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. /* First the winter-section... haha, very short. */
  32.  
  33. /* Now some shapes without texture */
  34.  
  35. // simple polygon with some jags
  36. #declare LEAFSHAPE_00 =
  37. union {
  38.    polygon {
  39.       13
  40.       <-1,0,0>,
  41.       <-0.5, 0, 0>
  42.       <0, 0.3, 0>
  43.       <0.5, 0, 0>
  44.       <1,0,0>,
  45.       <0.5,1,0>,
  46.       <1,2,0>,
  47.       <0.3,2,0>, 
  48.       <0,3,0>,
  49.       <-0.3,2,0>,
  50.       <-1,2,0>,
  51.       <-0.5,1,0>,
  52.       <-1,0,0>
  53.    }
  54.    cone {
  55.       <0, 0.3, 0>, 0.04, <0, -1, 0>, 0.07
  56.    }
  57.    translate <0, 1, 0>
  58. }
  59.  
  60.  
  61.  
  62. // a mesh, similar to LEAFSHAPE_00, but not as flat as LEAFSHAPE_00
  63. #declare LEAFSHAPE_01 =
  64. union{
  65.    mesh {
  66.       triangle { < 0.0, 3.0,-0.3>,  <-1.0, 1.5, 0.0>,  < 0.0, 1.5,-0.2> }
  67.       triangle { <-1.0, 1.5, 0.0>,  <-2.0, 1.0,-0.1>,  <-1.0, 0.5,-0.1> }
  68.       triangle { <-2.0, 1.0,-0.1>,  <-2.5, 0.5,-0.2>,  <-2.0, 0.0, 0.0> }
  69.       triangle { <-2.0, 1.0,-0.1>,  <-2.0, 0.0, 0.0>,  <-1.0, 0.5,-0.1> }
  70.       triangle { <-1.0, 0.5,-0.1>,  <-2.0, 0.0, 0.0>,  <-1.0,-0.5, 0.0> }
  71.       triangle { < 0.0, 1.5,-0.2>,  <-1.0, 1.5, 0.0>,  <-1.0, 0.5,-0.1> }
  72.       triangle { < 0.0, 1.5,-0.2>,  <-1.0, 0.5,-0.1>,  < 0.0, 0.5,-0.1> }
  73.       triangle { < 0.0, 0.5,-0.1>,  <-1.0, 0.5,-0.1>,  <-1.0,-0.5, 0.0> }
  74.       triangle { < 0.0, 0.5,-0.1>,  <-1.0,-0.5, 0.0>,  < 0.0,-0.5,-0.1> }
  75.       triangle { <-1.0,-0.5, 0.0>,  <-2.0,-1.5, 0.0>,  <-1.0,-1.5, 0.1> }
  76.       triangle { <-1.0,-1.5, 0.1>,  <-2.0,-1.5, 0.0>,  <-1.5,-2.0,-0.1> }
  77.       triangle { <-1.0,-1.5, 0.1>,  <-1.5,-2.0,-0.1>,  <-1.0,-2.0, 0.1> }
  78.       triangle { <-1.0,-2.0, 0.1>,  <-1.5,-2.0,-0.1>,  <-0.5,-2.5,-0.2> }
  79.       triangle { < 0.0,-2.0,-0.2>,  <-1.0,-2.0, 0.1>,  <-0.5,-2.5,-0.2> }
  80.       triangle { < 0.0,-0.5,-0.1>,  <-1.0,-0.5, 0.0>,  <-1.0,-2.0, 0.1> }
  81.       triangle { < 0.0,-0.5,-0.1>,  <-1.0,-2.0, 0.1>,  < 0.0,-2.0,-0.2> }
  82.       
  83.       triangle { <-0.0, 3.0,-0.3>,  < 1.0, 1.5, 0.0>,  <-0.0, 1.5,-0.2> }
  84.       triangle { < 1.0, 1.5, 0.0>,  < 2.0, 1.0,-0.1>,  < 1.0, 0.5,-0.1> }
  85.       triangle { < 2.0, 1.0,-0.1>,  < 2.5, 0.5,-0.2>,  < 2.0, 0.0, 0.0> }
  86.       triangle { < 2.0, 1.0,-0.1>,  < 2.0, 0.0, 0.0>,  < 1.0, 0.5,-0.1> }
  87.       triangle { < 1.0, 0.5,-0.1>,  < 2.0, 0.0, 0.0>,  < 1.0,-0.5, 0.0> }
  88.       triangle { <-0.0, 1.5,-0.2>,  < 1.0, 1.5, 0.0>,  < 1.0, 0.5,-0.1> }
  89.       triangle { <-0.0, 1.5,-0.2>,  < 1.0, 0.5,-0.1>,  <-0.0, 0.5,-0.1> }
  90.       triangle { <-0.0, 0.5,-0.1>,  < 1.0, 0.5,-0.1>,  < 1.0,-0.5, 0.0> }
  91.       triangle { <-0.0, 0.5,-0.1>,  < 1.0,-0.5, 0.0>,  <-0.0,-0.5,-0.1> }
  92.       triangle { < 1.0,-0.5, 0.0>,  < 2.0,-1.5, 0.0>,  < 1.0,-1.5, 0.1> }
  93.       triangle { < 1.0,-1.5, 0.1>,  < 2.0,-1.5, 0.0>,  < 1.5,-2.0,-0.1> }
  94.       triangle { < 1.0,-1.5, 0.1>,  < 1.5,-2.0,-0.1>,  < 1.0,-2.0, 0.1> }
  95.       triangle { < 1.0,-2.0, 0.1>,  < 1.5,-2.0,-0.1>,  < 0.5,-2.5,-0.2> }
  96.       triangle { <-0.0,-2.0,-0.2>,  < 1.0,-2.0, 0.1>,  < 0.5,-2.5,-0.2> }
  97.       triangle { <-0.0,-0.5,-0.1>,  < 1.0,-0.5, 0.0>,  < 1.0,-2.0, 0.1> }
  98.       triangle { <-0.0,-0.5,-0.1>,  < 1.0,-2.0, 0.1>,  <-0.0,-2.0,-0.2> }
  99.    }
  100.    cone {
  101.       <0, -2, -0.2>, 0.07, <0, -3.5, 0>, 0.1
  102.    }
  103.    translate <0, 3.5, 0>
  104.    scale 0.5
  105. }
  106.  
  107.  
  108.  
  109. // a simple flat pressed sphere
  110. #declare LEAFSHAPE_02 =
  111. union {
  112.    sphere {
  113.       <0,0,0>,2
  114.       scale <0.6,1,0.002>
  115.       translate <0, 2, 0>
  116.    }
  117.    cone {
  118.       <0,0,0>, 0.004, <0,-0.5,0>, 0.012
  119.    }
  120.    translate <0,0.5,0>
  121.    scale 0.65
  122. }
  123.  
  124.  
  125.  
  126. // a leaf mad of blob, slow to render
  127. #declare LEAFSHAPE_03 =
  128. union {
  129.    blob {
  130.       threshold 1
  131.       sphere { <-0.6, 0.0, 0>, 1.0, 1 }
  132.       sphere { < 0.6, 0.0, 0>, 1.0, 1 }
  133.       sphere { <-0.4, 0.4, 0>, 1.0, 1 }
  134.       sphere { < 0.4, 0.4, 0>, 1.0, 1 }
  135.       sphere { <-0.2, 0.8, 0>, 1.0, 1 }
  136.       sphere { < 0.2, 0.8, 0>, 1.0, 1 }
  137.       sphere { <   0, 1.2, 0>, 0.8, 1 }
  138.       sphere { <   0, 1.4, 0>, 0.5, 1 }
  139.       sphere { <   0, 1.6, 0>, 0.2, 1 }
  140.       
  141.       sphere { <-0.6, 0.0, 0.51>, 1.0, -1 }
  142.       sphere { < 0.6, 0.0, 0.51>, 1.0, -1 }
  143.       sphere { <-0.4, 0.4, 0.51>, 1.0, -1 }
  144.       sphere { < 0.4, 0.4, 0.51>, 1.0, -1 }
  145.       sphere { <-0.2, 0.8, 0.51>, 1.0, -1 }
  146.       sphere { < 0.2, 0.8, 0.51>, 1.0, -1 }
  147.       sphere { <   0, 1.2, 0.51>, 0.8, -1 }
  148.       sphere { <   0, 1.4, 0.51>, 0.5, -1 }
  149.       sphere { <   0, 1.6, 0.51>, 0.2, -1 }
  150.       
  151.       scale <1, 1.2, 0.05>
  152.    }
  153.    cone {
  154.       <0, 0, 0>, 0.04, <0, -1, 0>, 0.07
  155.    }
  156.    translate <0,1,0>
  157. }
  158.  
  159.  
  160.  
  161. // The Summer-Texture
  162.  
  163. #declare LEAF_TEXTURE_SUMMER = 
  164. texture {
  165.    pigment {
  166.       granite
  167.       color_map {
  168.      [0 color rgbt <0.05, 0.8, 0, 0.2>]
  169.      [1 color rgbt <0.05, 0.9, 0, 0.3>]
  170.       }
  171.       scale 0.025
  172.    }
  173.    finish {
  174.       ambient 0.1
  175.       diffuse 0.8
  176.       specular 0.1
  177.    }
  178.    normal {
  179.       bozo 0.1
  180.       scale 0.05
  181.    }
  182. }
  183.  
  184.  
  185. // The autumn-Texture
  186. #declare LEAF_TEXTURE_AUTUMN = 
  187. texture {
  188.    pigment {
  189.       bozo
  190.       color_map {
  191.      [0.0 color rgbt <0.7, 0.6, 0, 0.1>]
  192.      [0.2 color rgbt <0.8, 0.3, 0, 0.1>]
  193.      [0.36 color rgbt <0.8, 0.3, 0, 0.1>]
  194.      [0.4 color rgbt <0.7, 0.3, 0, 1.0>]
  195.      [0.43 color rgbt <0.6, 0.2, 0, 0.1>]
  196.      [0.6 color rgbt <0.6, 0.2, 0, 0.1>]
  197.      [0.8 color rgbt <0.5, 0.5, 0, 0.1>]
  198.      [1.0 color rgbt <0.7, 0.1, 0, 0.1>]
  199.       }
  200.       scale 0.25
  201.    }
  202.    finish {
  203.       ambient 0.1
  204.       diffuse 0.8
  205.       specular 0.1
  206.    }
  207.    normal {
  208.       bozo 0.1
  209.       scale 0.05
  210.    }
  211. }
  212.  
  213.  
  214.  
  215.  
  216.  
  217. // The Summer-Leaves
  218.  
  219. #declare LEAF_SUMMER_00 =
  220. object {
  221.    LEAFSHAPE_00
  222.    texture { LEAF_TEXTURE_SUMMER }
  223. }
  224.  
  225. #declare LEAF_SUMMER_01 =
  226. object {
  227.    LEAFSHAPE_01
  228.    texture { LEAF_TEXTURE_SUMMER }
  229. }
  230.  
  231. #declare LEAF_SUMMER_02 =
  232. object {
  233.    LEAFSHAPE_02
  234.    texture { LEAF_TEXTURE_SUMMER }
  235. }
  236.  
  237. #declare LEAF_SUMMER_03 =
  238. object {
  239.    LEAFSHAPE_03
  240.    texture { LEAF_TEXTURE_SUMMER }
  241. }
  242.  
  243. // The Autumn-Leaves
  244.  
  245. #declare LEAF_AUTUMN_00 =
  246. object {
  247.    LEAFSHAPE_00
  248.    texture { LEAF_TEXTURE_AUTUMN }
  249. }
  250.  
  251. #declare LEAF_AUTUMN_01 =
  252. object {
  253.    LEAFSHAPE_01
  254.    texture { LEAF_TEXTURE_AUTUMN }
  255. }
  256.  
  257. #declare LEAF_AUTUMN_02 =
  258. object {
  259.    LEAFSHAPE_02
  260.    texture { LEAF_TEXTURE_AUTUMN }
  261. }
  262.  
  263. #declare LEAF_AUTUMN_03 =
  264. object {
  265.    LEAFSHAPE_03
  266.    texture { LEAF_TEXTURE_AUTUMN }
  267. }
  268.  
  269.